import Vue from 'vue'
import Vuex from 'vuex'


Vue.use(Vuex)

const store = new Vuex.Store({
    state: {
        HOST: 'http://127.0.0.1:8888',
        isPlay: false,                      // 默认不播放
        songUrl: '',                        // 歌曲地址
        id: ''                              // 歌曲id
    },

    getters: {
        isPlay: state => state.isPlay,
        songUrl: state => state.songUrl,
        id: state => state.id,
    },

    mutations: {
        setIsPlay : (state,isPlay) => {state.isPlay = isPlay},
        setSongUrl: (state,songUrl) => {state.songUrl = songUrl},
    }
})


 export default store;